package com.brian.demo.hessian.test;

import com.brian.demo.hessian.bean.User;
import com.brian.demo.hessian.service.IUserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
//		HessianProxyFactory factory = new HessianProxyFactory();
//		String url = "http://localhost:9090/SpringHessianService/remoting/userService";
//		IUserService userService = (IUserService)factory.create(IUserService.class, url);
//		User u = new User();
//		u.setName("brian");
//		userService.addUser(u);
		
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring/applicationContext.xml");
		IUserService userService = (IUserService)ctx.getBean("userHessian");
		User u = new User();
		u.setName("张三");
		String result = userService.addUser(u);
		System.out.println("result: " + result);
	}

}
